﻿using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;

namespace FDSimpleModelGenerator.Common.Mvc.Middlewares
{
    public class UserContextMiddleware
    {
        private readonly RequestDelegate _next;

        public UserContextMiddleware(RequestDelegate next)
        {
            _next = next;
        }

        public async Task InvokeAsync(HttpContext context)
        {
            UserContext.Current.Init(context);
            await _next(context);
        }
    }
}
